from io import StringIO
from pdfminer.pdfinterp import PDFResourceManager,process_pdf
from pdfminer.converter import TextConverter
from pdfminer.layout import LAParams
import os


dir_path = os.path.dirname(os.path.abspath(__file__))
file_path = os.path.join(dir_path, '员工1_工资调整通知.pdf')

pdf_file = open(file_path, 'rb')

rsrcmgr=PDFResourceManager()
rettr=StringIO()
laparams=LAParams()

device=TextConverter(rsrcmgr,rettr,laparams=laparams)
process_pdf(rsrcmgr,device,pdf_file)
device.close()
content=rettr.getvalue()
rettr.close()
pdf_file.close()
print(content)